import request from '@/utils/request'

export function login(data) {
  console.log(data.username)
  const url = data.username !== 'admin' ? '/auth/loginEmploy' : '/auth/login';
  const params = data.username !== 'admin' ? { workNumber: data.username, mobile: data.password } : { username: data.username, password: data.password };
  return request({
    url: url,
    method: 'post',
    params:params
  })
}

export function getUserInfo(){
  return request({
    url:'/users/me'
  })
}

export function updatePassword(userId,password){
  return request({
    url:`/users/${userId}/password?password=${password}`,
    method:'patch'
  })
}
